import { httpService } from '@/api/base';
import type { IDataWithError } from '@/api/base';


export function apiUserLogin(name: string, pw: string): Promise<IDataWithError<RespUser>> {
  const req = { UserName: name, Password: pw }
  
  return httpService.actionGet("User.Login", req)
}
export function apiUserLogout(): Promise<IDataWithError<RespUser>> {
  return httpService.actionGet("User.Logout", {})
}


// admin
export function apiAdminUserCreate(req){
return  httpService.actionGet( "Admin.User.Create",req)
}
export function apiAdminUserUpdateStatus(req){
return  httpService.actionGet( "Admin.UserU.pdate.Status",req)
}
export function apiAdminUserUpdateUserType(req){
return  httpService.actionGet( "Admin.User.Update.UserType",req)
}
export function apiAdminUserResetPassword(req){
return  httpService.actionGet( "Admin.User.ResetPassword",req)
}
export function apiAdminUserList(req){
return  httpService.actionGet( "Admin.User.List",req)
}

// user
export function apiUserDetail(req){
  return httpService.actionGet("User.Detail",req)
}
export function apiChildDetail(req){
  return httpService.actionGet("User.ChildDetail",req)
}

export function apiUserUpdatePassword(req){
  return httpService.actionGet("User.Update.Password",req)
}
export function apiUserUpdate(req){
  return httpService.actionGet("User.Update",req)
}
export function apiUserDeleteChild(req){
  return httpService.actionGet("User.Delete.Child",req)
}



export function apiConfigList(req){
  return httpService.actionGet("Config.List",req)
}
export function apiConfigCreate(req){
  return httpService.actionGet("Config.Create", req)
}
export function apiConfigUpdate(req){
  return httpService.actionGet("Config.Update", req)
}
export function apiConfigDetail(req){
  return httpService.actionGet("Config.Detail", req)
}
export function apiConfigSetDefault(req){
  return httpService.actionGet("Config.SetDefault", req)
}
export function apiConfigGetDefault(req){
  return httpService.actionGet("Config.GetDefault", req)
}
export function apiConfigDelete(req){
  return httpService.actionGet("Config.Delete", req)
}


export function apiGroupList(req){
  return httpService.actionGet("DeviceGroup.List",req)
}
export function apiGroupCreate(req){
  return httpService.actionGet("DeviceGroup.Create", req)
}
export function apiGroupUpdate(req){
  return httpService.actionGet("DeviceGroup.Update", req)
}
export function apiGroupDetail(req){
  return httpService.actionGet("DeviceGroup.Detail", req)
}
export function apiGroupDelete(req){
  return httpService.actionGet("DeviceGroup.Delete", req)
}
export function apiDeviceList(req){
  return httpService.actionGet("Device.List",req)
}
export function apiDeviceCreate(req){
  return httpService.actionGet("Device.Create", req)
}
export function apiDeviceUpdate(req){
  return httpService.actionGet("Device.Update", req)
}
export function apiDeviceDetail(req){
  return httpService.actionGet("Device.Detail", req)
}
export function apiDeviceDelete(req){
  return httpService.actionGet("Device.Delete", req)
}

export function apiProductList(req){
  return httpService.actionGet("Product.List",req)
}
export function apiProductCreate(req){
  return httpService.actionGet("Product.Create", req)
}
export function apiProductUpdate(req){
  return httpService.actionGet("Product.Update", req)
}
export function apiProductDetail(req){
  return httpService.actionGet("Product.Detail", req)
}
export function apiProductDelete(req){
  return httpService.actionGet("Product.Delete", req)
}


export function apiTaskList(req){
  return httpService.actionGet("Task.List",req)
}
export function apiTaskCreate(req){
  return httpService.actionGet("Task.Create", req)
}
export function apiTaskUpdate(req){
  return httpService.actionGet("Task.Update", req)
}
export function apiTaskDetail(req){
  return httpService.actionGet("Task.Detail", req)
}
export function apiTaskDelete(req){
  return httpService.actionGet("Task.Delete", req)
}


export function apiTaskGroupList(req){
  return httpService.actionGet("TaskGroup.List",req)
}
export function apiTaskGroupCreate(req){
  return httpService.actionGet("TaskGroup.Create", req)
}
export function apiTaskGroupUpdate(req){
  return httpService.actionGet("TaskGroup.Update", req)
}
export function apiTaskGroupDetail(req){
  return httpService.actionGet("TaskGroup.Detail", req)
}
export function apiTaskGroupDelete(req){
  return httpService.actionGet("TaskGroup.Delete", req)
}


export function apiTaskLogList(req){
  return httpService.actionGet("TaskLog.List",req)
}
export function apiTaskLogCreate(req){
  return httpService.actionGet("TaskLog.Create", req)
}
export function apiTaskLogUpdate(req){
  return httpService.actionGet("TaskLog.Update", req)
}
export function apiTaskLogDetail(req){
  return httpService.actionGet("TaskLog.Detail", req)
}
export function apiTaskLogDelete(req){
  return httpService.actionGet("TaskLog.Delete", req)
}


// export function apiDfsUpload(file): Promise<IDataWithError<RespUser>> {
//     const formData = new FormData();

//     formData.append("file", file);
//     // const  reqStr =  "/standards/save?mainMajorId=1&mainMajorName=1&majorId=1&majorName=abc&skillExtractOn=1&skillList%5B0%5D.skillId=1&skillList%5B0%5D.skillName=aa&standardName=aaa&subMajorId=1&subMajorName=aa"
//     // return httpService.post("/dfs/upload",formData)
// }
